//
// Created by Administrator on 2020/8/19.
//
#include <iostream>
#include "Stock.h"

Stock::Stock() {
    this->stock = 0;
}

Stock::Stock(int initStock) {
    this->stock = initStock;
}

Stock::~Stock() {
    std::cout << "~Stock:" << this->stock << std::endl;
}

void Stock::incStock(const int stockNum) {
    this->stock = stockNum + this->stock;
}

void Stock::descStock(int stockNum) {
    this->stock = this->stock - stockNum;
}

void Stock::showStock() {
    std::cout << this->stock << std::endl;
}

const Stock &Stock::maxVal(const Stock &oStock) const {
    if (stock > oStock.stock) {
        return *this;
    } else {
        return oStock;
    }
}